--------------------------------------------------------------------------------------------------------------------------------------------------
--[[

    模块总入口，使用 common_postinit 进行嵌入初始化，注意 mastersim 区分

]]--
--------------------------------------------------------------------------------------------------------------------------------------------------
return function(inst)

    if TheWorld.ismastersim then
        if inst.components.hutao_com_rpc_event == nil then
            inst:AddComponent("hutao_com_rpc_event")
        end
        if inst.components.hutao_data == nil then
            inst:AddComponent("hutao_data")
        end
        if inst.components.hutao_com_dialogue == nil then
            inst:AddComponent("hutao_com_dialogue")
        end
        if inst.components.hutao_com_max_value_controller == nil then
            inst:AddComponent("hutao_com_max_value_controller")
        end
        if inst.components.hutao_com_sanity_custom_rate == nil then
            inst:AddComponent("hutao_com_sanity_custom_rate")
        end
        if inst.components.hutao_com_fire_damage == nil then
            inst:AddComponent("hutao_com_fire_damage")
            inst.components.hutao_com_fire_damage:AddAdditiveMultiplier(inst,1) -- 初始为1
        end
        if inst.components.hutao_com_blood_plum_scent_for_player == nil then
            inst:AddComponent("hutao_com_blood_plum_scent_for_player")
        end
        if inst.components.hutao_com_near_danger == nil then
            inst:AddComponent("hutao_com_near_danger")
        end
        if inst.components.hutao_com_inspect_data == nil then
            inst:AddComponent("hutao_com_inspect_data")
        end
    end

    local modules = {
        "prefabs/01_character/hutao_chracter_modules/01_custom_classified",                             ---- 专属classified
        "prefabs/01_character/hutao_chracter_modules/02_level_sys_install",                             ---- 等级系统
        "prefabs/01_character/hutao_chracter_modules/03_butterfly_frendly",                             ---- 蝴蝶友好
        "prefabs/01_character/hutao_chracter_modules/04_book_reader",                                   ---- 读书
        "prefabs/01_character/hutao_chracter_modules/05_talent_tree",                                   ---- 天赋树
        "prefabs/01_character/hutao_chracter_modules/06_eater_com_hook",                                ---- 吃东西的组件
        "prefabs/01_character/hutao_chracter_modules/07_cooking_sys",                                   ---- 烹饪系统
        "prefabs/01_character/hutao_chracter_modules/08_hotkey_event_listener",                         ---- 热键事件监听
        "prefabs/01_character/hutao_chracter_modules/09_physical_power_install",                        ---- 体力值系统
        "prefabs/01_character/hutao_chracter_modules/10_physical_power_hud",                            ---- 体力值HUD
        "prefabs/01_character/hutao_chracter_modules/12_polearm_mastery_install",                       ---- 长柄精通 模块
        "prefabs/01_character/hutao_chracter_modules/13_polearm_mastery_damage",                        ---- 长柄精通 伤害模块
        "prefabs/01_character/hutao_chracter_modules/14_polearm_mastery_hud",                           ---- 长柄精通 伤害HUD
        "prefabs/01_character/hutao_chracter_modules/15_requiem_ceremony_install",                      ---- 安魂仪式 指示器
        "prefabs/01_character/hutao_chracter_modules/16_requiem_ceremony_spell",                        ---- 安魂仪式 技能
        "prefabs/01_character/hutao_chracter_modules/17_seal_of_mystery_install",                       ---- 安神秘法 指示器
        "prefabs/01_character/hutao_chracter_modules/18_seal_of_mystery_spell",                         ---- 安神秘法 技能
        "prefabs/01_character/hutao_chracter_modules/19_butterfly_s_embrace",                           ---- 蝶引来生 技能
        "prefabs/01_character/hutao_chracter_modules/20_butterfly_s_embrace_indicator",                 ---- 蝶引来生 指示器
        "prefabs/01_character/hutao_chracter_modules/21_spell_finish_for_plum_blossom",                 ---- 技能完成(for 梅花)
        "prefabs/01_character/hutao_chracter_modules/22_healing_grove",                                 ---- 【郁愈域】
        "prefabs/01_character/hutao_chracter_modules/23_healing_grove_hud",                             ---- 【郁愈域】HUD
        "prefabs/01_character/hutao_chracter_modules/24_cosmic_hat_sys_install",                        ---- 乾坤帽模块
        "prefabs/01_character/hutao_chracter_modules/25_inventorybar",                                  ---- 检查按钮
        "prefabs/01_character/hutao_chracter_modules/26_exp_spawner",                                   ---- EXP经验生成器
    }
    for k, lua_addr in pairs(modules) do
        local temp_fn = require(lua_addr)
        if type(temp_fn) == "function" then
            temp_fn(inst)
        end
    end


    inst:AddTag("hutao")
    inst:AddTag("ghostlyfriend")

    -- inst.customidleanim = "moonlightcoda_funny_idle"  -- 闲置站立动画
    -- inst.talksoundoverride = "moonlightcoda_sound/moonlightcoda_sound/talk"
    -- inst.customidleanim = "idle_wendy"  -- 闲置站立动画



    inst:ListenForEvent("hutao_master_postinit",function(inst)
        
        inst.soundsname = "wendy"           -- 角色声音


        -- inst.skeleton_prefab = "hutao_cyclone_skeleton"    --- 客制化骷髅


    end)

    if not TheWorld.ismastersim then
        return
    end



end